<template>
  <div v-if="isNameArray">
    <div v-if="$store.state.Name[0].length > 100">
      <Item />
    </div>
    <div v-else>
      <Item1 />
    </div>
  </div>
  <div v-else>
    <h1>查询数据为空</h1>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useStore } from 'vuex'
import Item from '../../../components/Item.vue'
import Item1 from '../../../components/Item1.vue'

const store = useStore()

const isNameArray = computed(() => {
  // 首先检查$store.state.Name是否为数组
  if (!Array.isArray(store.state.Name)) {
    return false;
  }
  // 然后检查数组是否为空
  if (store.state.Name.length === 0) {
    return false;
  }
  // 如果都不是，返回true
  return true;
})

</script>

<style scoped></style>
